#-*-coding:UTF-8-*-


from quicksort import *
from bubblesort import *


SORT_DATAS = []
DEBUG = True


def init_sort_data():
    print('init sort data collection')
    global SORT_DATAS
    SORT_DATAS.append([6, 1, 2, 7, 9, 3, 4, 5, 10, 8])
    SORT_DATAS.append([6, 1, 2, 7, 9, 3, 4, 5, 6, 8])
    SORT_DATAS.append([72, 6, 57, 88, 60, 42, 83, 73, 48, 85])
    SORT_DATAS.append([49, 38, 65, 97, 76, 13, 27, 49])
    return SORT_DATAS


def test_sort(sort_funcs, debug=False):
    for the_func in sort_funcs:
        print('-'*50)
        print('Sort function: \n%s: %s'%(the_func.func_name, the_func.func_doc))
        for data in SORT_DATAS:
            print('before sort: %s'%data)
            the_func(data, debug=debug)
            print('after  sort: %s'%data)


def init_sort_funcs():
    #sort_funcs = [quick_sort, bubble_sort]
    sort_funcs = [bubble_sort]
    return sort_funcs


if __name__ == '__main__':
    print('sort algorithm example:')
    DEBUG = True
    sort_funcs = init_sort_funcs()
    init_sort_data()
    test_sort(sort_funcs, debug=DEBUG)

